home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr11 / pdox693.zip / TI497.ASC < prev    next >
Text File  |  1992-08-12  |  5KB  |  199 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.   PRODUCT  :  Paradox                                NUMBER  :  497
  9.   VERSION  :  3.xx
  10.        OS  :  DOS
  11.      DATE  :  August 12, 1992                          PAGE  :  1/3
  12.  
  13.     TITLE  :  PRINTING MULTIPLE LABELS FOR EACH RECORD IN A TABLE
  14.  
  15.  
  16.  
  17.  
  18.   Imagine that you need to print multiple labels for each record in
  19.   a table.  Normally, you would use the report generator to output
  20.   a report, however, reports in Paradox can print each record only
  21.   one time.  This is useful when you have to print labels for
  22.   shipping several boxes to the same address and you want to label
  23.   each box 1 of 5, 2 of 5, etc.
  24.  
  25.   The following script is an example of how to create those records
  26.   in a new table.  The script creates an output table on the fly,
  27.   brings both the old table and the output table on the workspace.
  28.   It then scans through the original table to get the existing
  29.   records information.  Once it has the number of records to be
  30.   created in the output table, it then inserts n number of records
  31.   in the output table using the CopyFromArray PAL command.  Last
  32.   but not least, it will number the records in the output table.
  33.  
  34.   The script needs a source table called "ORIGINAL" with the
  35.   following structure:
  36.  
  37.  
  38.        Field Name          Field Type
  39.        FIRST NAME             A15
  40.        LAST NAME              A30
  41.        ADDRESS 1              A40
  42.        CITY NAME              A20
  43.        STATE                  A2
  44.        ZIP CODE               A5
  45.        LABEL COUNT            S
  46.  
  47.  
  48.   The field called "LABEL COUNT" is used to determine the number of
  49.   records to place in the output table.  The name of the output
  50.   table that is created is called "LABELRPT".  All references to
  51.   table names and field names may be changed at will.
  52.  
  53.   Once you have actually implemented the PAL code, you can then use
  54.   the output table to print reports that produce labels that are
  55.   number x of n where x is the count of the number of labels
  56.   printed so far and where n is the total number of labels to be
  57.   printed.
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.   PRODUCT  :  Paradox                                NUMBER  :  497
  75.   VERSION  :  3.xx
  76.        OS  :  DOS
  77.      DATE  :  August 12, 1992                          PAGE  :  2/3
  78.  
  79.     TITLE  :  PRINTING MULTIPLE LABELS FOR EACH RECORD IN A TABLE
  80.  
  81.  
  82.  
  83.  
  84.   For example, you could print labels like...
  85.  
  86.  
  87.  
  88.        Johnny Johnson           1 of  2
  89.        1800 Green Hills Road
  90.        Scotts Valley, CA  95066-0001
  91.  
  92.        Johnny Johnson           2 of  2
  93.        1800 Green Hills Road
  94.        Scotts Valley, CA  95066-0001
  95.  
  96.  
  97.  
  98.  
  99.   Here is the actual code that will do all the work:
  100.  
  101.  
  102.  
  103.   If IsTable("labelrpt") Then              ; Delete Output Table
  104.     Delete "labelrpt"
  105.   EndIf
  106.  
  107.   Create "labelrpt"                        ; Create Output Table
  108.     "First Name"  : "A15",                 ; First Name field
  109.     "Last Name"   : "A30",                 ; Last Name field
  110.     "Address 1"   : "A40",                 ; Address field
  111.     "City Name"   : "A20",                 ; City field
  112.     "State"       : "A2",                  ; State field
  113.     "Zip Code"    : "A5",                  ; Zip code field
  114.     "Label #"     : "S",                   ; Label # field
  115.     "Label Total" : "S"                    ; Label total field
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.   PRODUCT  :  Paradox                                NUMBER  :  497
  141.   VERSION  :  3.xx
  142.        OS  :  DOS
  143.      DATE  :  August 12, 1992                          PAGE  :  3/3
  144.  
  145.     TITLE  :  PRINTING MULTIPLE LABELS FOR EACH RECORD IN A TABLE
  146.  
  147.  
  148.  
  149.  
  150.   Proc MakeLabels()                        ; Define procedure
  151.     ClearAll                               ; Clear the WorkSpace
  152.     Clear                                  ; Clear the PAL Canvas
  153.     View "labelrpt"                        ; View the output table
  154.     View "original"                        ; View original table
  155.     Editkey                                ; Place tables in EDIT
  156.     Scan                                   ; Begin Scan Loop
  157.       MakeRecNo = [Label Count]            ; Get number of records
  158.       CopyToArray HoldRec                  ; Copy record to memory
  159.       Message "Processing Record ",RecNo() ; Display user message
  160.       UpImage                              ; Moveto output table
  161.       For lv from 1 to MakeRecNo           ; Begin making records
  162.         CopyFromArray HoldRec              ; Insert a copy
  163.            [Label Total] = [Label #]       ; Modify records number
  164.         [Label #] = lv                     ; Define records total
  165.         Down                               ; Moveto blank record
  166.       EndFor                               ; End making records
  167.       DownImage                            ; Moveto original table
  168.     EndScan                                ; End Scan Loop
  169.     DO_IT!                                 ; Save output records
  170.     ClearImage                             ; Clear original table
  171.     Home                                   ; Moveto record #1
  172.   EndProc                                  ; End Procedure
  173.  
  174.   MakeLabels()                             ; Invoke the procedure
  175.  
  176.   DISCLAIMER: You have the right to use this technical information
  177.   subject to the terms of the No-Nonsense License Statement that
  178.   you received with the Borland product to which this information
  179.   pertains.
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.